/**
 * 角色详情对话框
 */
var RoleInfoDlg = {
    data: {
        pid: "",
        pName: ""
    }
};

layui.use(['layer', 'form', 'admin', 'ax','rate','util'], function () {
    var $ = layui.jquery;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var rate = layui.rate;
    var util = layui.util;
    // 让当前iframe弹层高度适应
    admin.iframeAuto();

    //初始详情数据

    var ajax = new $ax(Feng.ctxPath + "/opencard/opencardDetailData/"  + Feng.getUrlParam("id"));
    var result = ajax.start();
    //详情字段填充
    $("#shopNo").text(result.data.shopId)//商户编号
    $("#shopName").text(result.data.shopName)//商户名
    $("#shopAdr").text(result.data.shopAdr)//商户地址
    $("#phone").text(result.data.phone)//电话
    $("#deposit").text(result.data.deposit+'元')//押金
    if(result.data.payTime!=''){
        $("#payTime").text(util.toDateString(new Date(result.data.payTime).getTime(),'yyyy-MM-dd HH:mm:ss'))//支付时间
    }
    if(result.data.confirmTime!=''){
        $("#confirmTime").text(util.toDateString(new Date(result.data.confirmTime).getTime(),'yyyy-MM-dd HH:mm:ss'))//确认时间
    }
    if(result.data.openCardTime!=''){
        $("#openCardTime").text(util.toDateString(new Date(result.data.openCardTime).getTime(),'yyyy-MM-dd HH:mm:ss'))//开卡时间
    }
    $("#electricCardNo").text(result.data.electricCardNo)//电卡

    //图片
    /*var imgAaary = result.data.submitImages==''?[]: result.data.submitImages.split(',')
    imgAaary.forEach((img,index)=>{
        $("#submitImages").append(`<img src="${img}" class="repair-img" />`)
    })*/

    //评价
    rate.render({
        elem: '#test1',
        value: 2, //初始值
        readonly: true
    });
    rate.render({
        elem: '#test2',
        value: 2, //初始值
        readonly: true
    });
    rate.render({
        elem: '#test3',
        value: 2, //初始值
        readonly: true
    });

    //开卡进度
    result.data.openCardSchedule.forEach(function(item,index){
        var content= '<li class="layui-timeline-item"><i class="layui-icon layui-timeline-axis"></i> ' +
            '<div class="layui-timeline-content layui-text">' +
            '<h3 class="layui-timeline-title">  '+util.toDateString(new Date(item.createTime).getTime(),"yyyy-MM-dd HH:mm:ss")+'</h3>' +
            '<p>'+item.operationDesc+'</p> </div> </li>'
        $("#repairSchedule").append(content)
    })
});